$.extend($.fn.treegrid.methods, {
    //iscontains是否包含父节点（即子节点被选中时是否也取父节点）
    getAllChecked: function (jq, isContains) {
        var keyValues = new Array();
        /*
          tree-checkbox2 有子节点被选中的css 1
          tree-checkbox1 节点被选中的css 2
          tree-checkbox0 节点未选中的css 0
        */
        var checkNodes = jq.treegrid("getPanel").find(".tree-checkbox1");
        for (var i = 0; i < checkNodes.length; i++) {
            var keyValue1 = $($(checkNodes[i]).closest('tr')[0]).attr("node-id");
            keyValues.push({"id": keyValue1, "state": "2"});

        }

        if (isContains) {
            var childCheckNodes = jq.treegrid("getPanel").find(".tree-checkbox2");
            for (var i = 0; i < childCheckNodes.length; i++) {
                var keyValue2 = $($(childCheckNodes[i]).closest('tr')[0]).attr("node-id");
                keyValues.push({"id": keyValue2, "state": "1"});
            }
        }

        return keyValues;
    }
});
